// express.js

// 引入express
const express = require('express')
// 创建实例
const app = express()
// 后端路由
app.all('/server-get', (request, response) => {
    response.setHeader('Access-Control-Allow-Origin', '*')
    response.setHeader('Access-Control-Allow-Headers', '*')
    response.send('get 成功')
})
app.post('/server-post', (request, response) => {
    response.setHeader('Access-Control-Allow-Origin', '*')
    response.send('post 成功')
})
// 监听
app.listen(8000, () => {
    console.log('8000端口启动...')
})